/*
 * @: 
 * @version: 1.0
 * @Author: ziwei
 * @Date: 2021-11-28 23:23:27
 * @LastEditors: ziwei
 * @LastEditTime: 2021-11-28 23:28:20
 */
import {NAMESPACE_SEP} from './constant'

//把一个对象的key从一个老的值编程 namespace/老的值
function prefix(obj,namespace){
    return Object.keys.reduce(function(memo,key){
        const newKey = `${namespace}${NAMESPACE_SEP}${key}`
        memo[newKey]=obj[key]
        return memo;
    },{});
}

export default function prefixNamespace(model){
    if(model.reducers){
        model.reducers = prefix(model.reducers,model.namespace)
    }
}